
// http({ url: "www.baidu.com", method: "GET", data: { id: 1001 } })

interface IParam {
    url: string
    method?: "POST" | "GET",
    data?: Object

}
import config from "./config"

export function http(params: IParam) {
    return new Promise((resolve, reject) => {
        wx.request({
            ...params,
            url: config.baseUrl + params.url,
            success: res => {
                resolve(res)
            },
            fail: err => {
                reject(err)
            }
        })
    })


}